package tests;

import static org.junit.Assert.*;
import business.Aluno;
import business.CalendarDate;
import business.Curso;
import business.Disciplina;
import business.Inicial;
import business.Inscricao;
import business.Matricula;
import business.Oferta;
import business.Perfil;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;


//some methods discarded for better coverage

public class AlunoTest {

	
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		Inicial.reset();
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}
	
	@Test (expected=AssertionError.class)
	public void constructAssertionTester1(){
		//case one: invalid number
		Aluno a = new Aluno("john doe",new CalendarDate(),"john@doe.com",-1);
	}
	
	@Test
	public void constructTester(){
	
		Aluno b = new Aluno("John Doe", new CalendarDate(1,1,1970), "john@doe.com", 12);
		
		b.getNome();
		b.getDataNascimento();
		b.getEmail();
		b.getNumero();
	
	}
	
	@Test (expected = AssertionError.class)
	public void setNomeAssertionTester(){
		Aluno d = new Aluno();
		d.setNome(null);
	}
	
	@Test (expected = AssertionError.class)
	public void setDNAssertionTester(){
		Aluno d = new Aluno();
		
		d.setDataNascimento(null);
	}
	
	@Test (expected = AssertionError.class)
	public void setEmailAssertionTester(){
		Aluno d = new Aluno();
		
		d.setEmail(null);
	}
	
	@Test (expected = AssertionError.class)
	public void setNumeroAssertionTester(){
		Aluno d = new Aluno();
		d.setNumero(-1);
	}
	
	
	@Test
	public void test8(){
		Aluno d = new Aluno();
		
		d.setNome("John Doe");
	}
	
	@Test
	public void test9(){
		Aluno d = new Aluno();
		
		d.setDataNascimento(new CalendarDate(10, 11, 1989));
	}
	
	@Test
	public void test10(){
		Aluno d = new Aluno();
		
		d.setEmail("john@doe.com");
	}
	
	@Test
	public void test11(){
		Aluno d = new Aluno();
		
		d.setNumero(3536);
	}
	
//	@Test
//	public void loadTest(){
//		Inicial.open("data/2c.cmd");
//	}
	
	@Test
	public void matriculasTester(){
		Matricula m = new Matricula();
		Aluno a = new Aluno();
		m.setAluno(a);
		a.matriculas();
	}
	
	@Test
	public void perfisTester(){
		Matricula m = new Matricula();
		Perfil p = new Perfil();
		Aluno a = new Aluno();
		
		m.setPerfil(p);
		m.setAluno(a);
		
		a.perfis();
	}
	
	@Test
	public void creditosObtidosTester(){
		Oferta o = new Oferta();
		Perfil p = new Perfil();
		Curso c = new Curso();
		Aluno a = new Aluno();
		Disciplina d = new Disciplina();
		
		p.setCurso(c);
		o.setPerfil(p);
		o.setDisciplina(d);
		
		
		a.creditosObtidos(c);
	}
	
	@Test (expected=AssertionError.class)
	public void creditosObtidosAssertionTester(){
		Aluno a = new Aluno();
		a.creditosObtidos(null);
	}
	
	@Test
	public void aprovadasTester(){
		Inscricao i = new Inscricao();
		Aluno a = new Aluno();
		Disciplina d = new Disciplina();
		
		i.setAluno(a);
		i.setResultado(12);
		i.setDisciplina(d);
		
		a.aprovadas();
	}
	
	@Test
	public void toStringTester(){
		Aluno a = new Aluno();
		a.toString();
	}
	
	@Test
	public void disciplinasTester(){
		Disciplina d = new Disciplina();
		Inscricao i = new Inscricao();
		i.setDisciplina(d);
		
		Aluno a = new Aluno();
		i.setAluno(a);
		a.disciplinas();
	}
	
	@Test
	public void objectosTester(){
		new Aluno().objectos();
	}
	

}
